#ifndef FLOWEDGE_H
#define FLOWEDGE_H

#include <QtWidgets>
#include "define.h"
class FlowNode;

class FlowEdge : public QGraphicsItem
{
public:
    FlowEdge(FlowNode *sourceNode, FlowNode *destNode);
    ~FlowEdge();

    FlowNode *sourceNode() const;
    FlowNode *destNode() const;

    void adjust();

    enum ArrowType{ ArrowSrc=1, ArrowDest=2, ArrowBoth=3};
    void setArrow(ArrowType at);  //默认是ArrowBoth
    void setArrowSize(int sz){ arrowSize = sz; }  //默认是12

    int type() const override { return ItemIgnoreHit; }

protected:
    QRectF boundingRect() const override;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;

private:
    FlowNode *source, *dest;

    QPointF sourcePoint;
    QPointF destPoint;
    qreal arrowSize;
    ArrowType atype;
};

#endif // FLOWEDGE_H
